<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 字符串方法 </title>
</head>
<body>
<h2> toUpperCase() 转换为大写和小写</h2>
<p>把字符串转换为大写：</p>
<button onclick="myFunction()">试一试</button>

<p id="demo">Hello World</p>

<script>
  function myFunction(){
    var text= document.getElementById("demo").innerHTML;
    document.getElementById("demo").innerHTML=text.toUpperCase();
  // 字符串转换为小写：  text.toLowerCase();
  }
</script>
</body>
</html>